{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Distribution\n",
    "> the way in which something is shared out among a group or spread over an area\n",
    "\n",
    "### Random Variable\n",
    "> a variable whose value is subject to variations due to chance (i.e. randomness, in a mathematical sense). A random variable can take on a set of possible different values (similarly to other mathematical variables), each with an associated probability [wiki](https://en.wikipedia.org/wiki/Random_variable)\n",
    "\n",
    "**Types**\n",
    "\n",
    "1. Discrete Random Variables <br>\n",
    "    Eg: Genders of the buyers buying shoe\n",
    "2. Continuous Random Variables <br>\n",
    "    Eg: Shoe Sales in a quarter\n",
    "    \n",
    "### Probability Distribution\n",
    "> Assigns a probability to each measurable subset of the possible outcomes of a random experiment, survey, or procedure of statistical inference. [wiki](https://en.wikipedia.org/wiki/Probability_distribution)\n",
    "\n",
    "#### Probability Mass Function\n",
    "probability mass function (pmf) is a function that gives the probability that a discrete random variable is exactly equal to some value\n",
    "\n",
    "#### Discrete probability distribution(Cumulative Mass Function)\n",
    "probability distribution characterized by a probability mass function\n",
    "\n",
    "#### Probability Density Function\n",
    "function that describes the relative likelihood for this random variable to take on a given value\n",
    "\n",
    "#### Continuous probability distribution(Cumulative Density function)\n",
    "probability that the variable takes a value less than or equal to `x`\n",
    "\n",
    "### Central Limit Theorem\n",
    "Given certain conditions, the arithmetic mean of a sufficiently large number of iterates of independent random variables, each with a well-defined expected value and well-defined variance, will be approximately normally distributed, regardless of the underlying distribution. [wiki](https://en.wikipedia.org/wiki/Central_limit_theorem)\n",
    "\n",
    "#### Normal Distribution\n",
    "A bell shaped distribution. It is also called Gaussian distribution\n",
    "\n",
    "<img style=\"float: left;\" src=\"img/normaldist.png\" height=\"220\" width=\"220\">\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "\n",
    "\n",
    "\n",
    "**PDF**\n",
    "<br>\n",
    "<br>\n",
    "<img style=\"float: left;\" src=\"img/normal_pdf.png\" height=\"320\" width=\"320\">\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "\n",
    "**CDF**\n",
    "<br>\n",
    "<br>\n",
    "\n",
    "\n",
    "<img style=\"float: left;\" src=\"img/normal_cdf.png\" height=\"320\" width=\"320\">\n",
    "\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "\n",
    "\n",
    "#### Skewness\n",
    "Measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. [wiki](https://en.wikipedia.org/wiki/Skewness)\n",
    "\n",
    "<img style=\"float: left;\" src=\"img/skewness.png\" height=\"620\" width=\"620\">\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "#### Kurtosis\n",
    "Measure of the \"peakedness\" of the probability distribution of a real-valued random variable [wiki](https://en.wikipedia.org/wiki/Kurtosis)\n",
    "<br>\n",
    "<br>\n",
    "<img style=\"float: left;\" src=\"img/kurtosis.png\" height=\"420\" width=\"420\">\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "\n",
    "#### Binomial Distribution\n",
    "\n",
    "Binomial distribution with parameters `n` and `p` is the discrete probability distribution of the number of successes in a sequence of n independent yes/no experiments, each of which yields success with probability p. A success/failure experiment is also called a Bernoulli experiment or Bernoulli trial; when n = 1, the binomial distribution is a Bernoulli distribution  [wiki](https://en.wikipedia.org/wiki/Binomial_distribution)\n",
    "<br>\n",
    "<br>\n",
    "<img style=\"float: left;\" src=\"img/binomial_pmf.png\" height=\"420\" width=\"420\">\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "\n",
    "\n",
    "#### Exponential Distribution\n",
    "Probability distribution that describes the time between events in a Poisson process, i.e. a process in which events occur continuously and independently at a constant average rate. It has the key property of being memoryless. [wiki](https://en.wikipedia.org/wiki/Exponential_distribution)\n",
    "<br>\n",
    "<br>\n",
    "<img style=\"float: left;\" src=\"img/exponential_pdf.png\" height=\"420\" width=\"420\">\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "\n",
    "#### Uniform distribution\n",
    "All values have the same frequency [wiki](https://en.wikipedia.org/wiki/Uniform_distribution_(continuous))\n",
    "\n",
    "\n",
    "<br> \n",
    "<br>\n",
    "<img style=\"float: left;\" src=\"img/uniform.png\" height=\"420\" width=\"420\">\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "<br>\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "### 6-sigma philosophy\n",
    "<img style=\"float: left;\" src=\"img/6sigma.png\" height=\"520\" width=\"520\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Histograms\n",
    "\n",
    "Most commonly used representation of a distribution.\n",
    "\n",
    "Let's plot distribution of weed prices for 2014"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "sns.set(color_codes=True)\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#Import the data\n",
    "weed_pd = pd.read_csv(\"../data/Weed_Price.csv\", parse_dates=[-1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x10b4a54d0>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAERCAYAAACdPxtnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFs1JREFUeJzt3X9s5Hed3/GnvZt41vZ4iW5dAiriKlreSq+kzS84yHGB\nkrtrOFVpqe5OSu8aoibpcSmQUkrvQiDilAgol0hEgvyRHE1yVKAmIteSKEtQSNlkKy6bNokahb7J\nj14pOlp2l82uZ9b2/vD0jxlnbe/M2h6P7Rl/ng9ptePP9zvf+Xw//nhe35+f71Cj0UCSVKbhza6A\nJGnzGAKSVDBDQJIKZghIUsEMAUkqmCEgSQXbfqaJEXEW8DXgrcAIcCvwE+Bh4Eet2b6amQ9ExHXA\n9cAJ4NbMfCQidgBfByaBKeDqzDywLmsiSVq1oTPdJxARHwbOz8xPRMQ5wPPA54CdmXnHgvnOBR4D\nLgJ2AE8BFwP/EhjPzD+OiN8B3p2ZN67XykiSVueMewLAA8CDrdfDwHGaX/QREVcCLwE3Au8E9mbm\nceB4RLwMnA9cCnyx9f7dwGd6W31J0lqc8ZxAZtYzsxYRVZqB8GngaeCTmXkZ8CpwC1AFDi946xSw\nE5gAjiwpkyT1iWVPDEfEW4DvAfdn5jeBhzLz2dbkh4ALaH7RVxe8rQq8tqR8vkyS1CeWOzH8RprH\n+v8gM59oFe+OiI9l5j7gcuAZmnsHt0XECFABzg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Yn4Xd5rm7v0zhfaLpW0xB3yrxH6RmZdl5vsy8/3Ac8A/o/k3Uly/aNMWVwN/vtZ+sRknhr8M\n/BaQC4o/DtxJ8wqIF4HrWmf7r6V5hnsYuC0zH9rQyq6zDm3xhzQfvHMc+ClwfeuQ0VZvix00r/g4\nFzgL+DzwP2luBZfWL9q1xY+Br1BYv1iotQX8L2heMVVcv1hoQVvsYI39wrGDJKlg3iwmSQUzBCSp\nYIaAJBXMEJCkghkCklQwQ0CSCrYZYwdJmyYifhF4IjP/xpLyOZoDcl2cmbec4f3/BbglM7/fZtoF\nwBeAt9C8wesHNG8E/HnPVkDqMfcEpJbM/PaZAqCl7Y01EfF2YDfwhcz828A7aA7o9b3WyI9SX3JP\nQGqJiKuB92XmNRHxPpp3sZ+guUV/Xut2fYBrI+J24Bzg45n5MPAp4J7MfAIgMxvAFyPiHwP/BPjm\nxq6NtDLuCahEb46IZxf+WzgxIrYDfwZclZkXAsc4tQcwBBzKzIuBjwGfbZVfQnPMlqX2AL+8Hish\n9YJ7AirRX2XmBQsLWucE5r0D+H+ZOT/o1tdoDukMzTD489brF4Fdy3zWKB0OIUn9wD0B6XQnWfy3\nMbRk+onW/40F0/axYIs/In6h9fKdbL0Hm2gLMQSk0/0QOCci/k7r56tY/MyLdr4IXBMRf7/1jOCH\nI+I7wDjwjfWrqrQ2hoBKdKbDM43WY/l+F7g/Ip4B/jrNcf07LiszX6I5tv0f0Ry7/RyaT3c6RPOB\n4FJfcihpaYmIGKJ5vf/nMvNoRHwCeFNm/psulrULeHtm/tde11PqBUNAaiMi/i3Np1gdA/4X8M8z\nc6s9rlAyBCSpZJ4TkKSCGQKSVDBDQJIKZghIUsEMAUkqmCEgSQX7/8L1068H/zvSAAAAAElFTkSu\nQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10691f2d0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.distplot(weed_pd.HighQ, kde=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "weed_pd[\"month\"] = weed_pd[\"date\"].apply(lambda x: x.month)\n",
    "weed_pd[\"year\"] = weed_pd[\"date\"].apply(lambda x: x.year)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "weed_jan2015_summarized = weed_pd.loc[(weed_pd.month==1) & (weed_pd.year==2015), [\"State\", \"HighQ\"]].groupby(\"State\").mean().reset_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>State</th>\n",
       "      <th>HighQ</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Alabama</td>\n",
       "      <td>336.504839</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Alaska</td>\n",
       "      <td>302.972581</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Arizona</td>\n",
       "      <td>297.782903</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Arkansas</td>\n",
       "      <td>341.705806</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>California</td>\n",
       "      <td>243.602258</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Colorado</td>\n",
       "      <td>243.273226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Connecticut</td>\n",
       "      <td>336.442258</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Delaware</td>\n",
       "      <td>363.908387</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>District of Columbia</td>\n",
       "      <td>348.107097</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Florida</td>\n",
       "      <td>300.604194</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Georgia</td>\n",
       "      <td>323.562581</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Hawaii</td>\n",
       "      <td>306.979677</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Idaho</td>\n",
       "      <td>274.990323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Illinois</td>\n",
       "      <td>353.133226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Indiana</td>\n",
       "      <td>332.059677</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Iowa</td>\n",
       "      <td>364.967742</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Kansas</td>\n",
       "      <td>349.559032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Kentucky</td>\n",
       "      <td>339.014516</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Louisiana</td>\n",
       "      <td>361.621290</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Maine</td>\n",
       "      <td>310.723548</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Maryland</td>\n",
       "      <td>364.671935</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Massachusetts</td>\n",
       "      <td>344.880323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Michigan</td>\n",
       "      <td>287.620000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Minnesota</td>\n",
       "      <td>349.167097</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Mississippi</td>\n",
       "      <td>336.288065</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Missouri</td>\n",
       "      <td>351.059355</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Montana</td>\n",
       "      <td>265.517097</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Nebraska</td>\n",
       "      <td>335.264839</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Nevada</td>\n",
       "      <td>265.610968</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>New Hampshire</td>\n",
       "      <td>353.643548</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>New Jersey</td>\n",
       "      <td>345.144839</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>New Mexico</td>\n",
       "      <td>288.175161</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>New York</td>\n",
       "      <td>343.555161</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>North Carolina</td>\n",
       "      <td>344.903871</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>North Dakota</td>\n",
       "      <td>392.652581</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>Ohio</td>\n",
       "      <td>332.440323</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>Oklahoma</td>\n",
       "      <td>353.359677</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>Oregon</td>\n",
       "      <td>205.483226</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>Pennsylvania</td>\n",
       "      <td>362.544194</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>Rhode Island</td>\n",
       "      <td>317.085806</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>South Carolina</td>\n",
       "      <td>337.197419</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>South Dakota</td>\n",
       "      <td>357.954516</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>Tennessee</td>\n",
       "      <td>347.931613</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>Texas</td>\n",
       "      <td>333.814194</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>Utah</td>\n",
       "      <td>289.862258</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>Vermont</td>\n",
       "      <td>370.526452</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>Virginia</td>\n",
       "      <td>364.769032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>Washington</td>\n",
       "      <td>233.028387</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>West Virginia</td>\n",
       "      <td>358.037742</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>Wisconsin</td>\n",
       "      <td>349.942903</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>Wyoming</td>\n",
       "      <td>320.450968</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   State       HighQ\n",
       "0                Alabama  336.504839\n",
       "1                 Alaska  302.972581\n",
       "2                Arizona  297.782903\n",
       "3               Arkansas  341.705806\n",
       "4             California  243.602258\n",
       "5               Colorado  243.273226\n",
       "6            Connecticut  336.442258\n",
       "7               Delaware  363.908387\n",
       "8   District of Columbia  348.107097\n",
       "9                Florida  300.604194\n",
       "10               Georgia  323.562581\n",
       "11                Hawaii  306.979677\n",
       "12                 Idaho  274.990323\n",
       "13              Illinois  353.133226\n",
       "14               Indiana  332.059677\n",
       "15                  Iowa  364.967742\n",
       "16                Kansas  349.559032\n",
       "17              Kentucky  339.014516\n",
       "18             Louisiana  361.621290\n",
       "19                 Maine  310.723548\n",
       "20              Maryland  364.671935\n",
       "21         Massachusetts  344.880323\n",
       "22              Michigan  287.620000\n",
       "23             Minnesota  349.167097\n",
       "24           Mississippi  336.288065\n",
       "25              Missouri  351.059355\n",
       "26               Montana  265.517097\n",
       "27              Nebraska  335.264839\n",
       "28                Nevada  265.610968\n",
       "29         New Hampshire  353.643548\n",
       "30            New Jersey  345.144839\n",
       "31            New Mexico  288.175161\n",
       "32              New York  343.555161\n",
       "33        North Carolina  344.903871\n",
       "34          North Dakota  392.652581\n",
       "35                  Ohio  332.440323\n",
       "36              Oklahoma  353.359677\n",
       "37                Oregon  205.483226\n",
       "38          Pennsylvania  362.544194\n",
       "39          Rhode Island  317.085806\n",
       "40        South Carolina  337.197419\n",
       "41          South Dakota  357.954516\n",
       "42             Tennessee  347.931613\n",
       "43                 Texas  333.814194\n",
       "44                  Utah  289.862258\n",
       "45               Vermont  370.526452\n",
       "46              Virginia  364.769032\n",
       "47            Washington  233.028387\n",
       "48         West Virginia  358.037742\n",
       "49             Wisconsin  349.942903\n",
       "50               Wyoming  320.450968"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "weed_jan2015_summarized"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Question If you'd randomly landed in USA, with equal chances of landing in any of the states, what is the probability that the price of weed is more than 340. (Bin the prices by $10)**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x10be438d0>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAERCAYAAAB7FtAjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xlwm+dh5/EvDgIgQfAQD0nUYVnXY9mWYllS7NiuZddx\nk7RxnCZts27T3XrqZttmNp1J2zTN5Jid6WzT8cSzzbTx7tpx3W67zcbZOIcTO2kVx45lx5avWLKs\nRxJ1SxTvAwABkATe/QMvJFA8IFIgAQK/z4zHBB68wINHIH58nud9n8fjOA4iIiLeUldARETKgwJB\nREQABYKIiLgUCCIiAigQRETEpUAQEREA/LMVGmO8wNeAbUAKeMBa25lXfg/wBWACeMxa+6gxpgZ4\nDLgKCAJ/Za39vjFmI/A4kAEOAJ+01uqcVxGRMlGoh/BhIGCtvQX4LPCVXIH7xf8QcDewG/iEMaYd\n+B2g11p7O/B+4O/cQx4CPufe7wHuLeYbERGRK1MoEG4FngGw1r4M7Mwr2wIctdYOW2vHgReA24En\ngC/mPf+4+/ON1trn3Z+fBt575dUXEZFimXXICGgARvJup40xXmttxi0bziuLAo3W2jiAMSYCfAv4\nvFvuyXtsDGi8koqLiEhxFeohjACR/Me7YQDZMMgviwCDAMaYNcBPgH+01n7DLc9c8tih+VZaRESK\nr1APYS9wD/CEMeZm4K28skPAJmNMMxAnO1z0oDFmOfBj4I+ttc/mPf4NY8xua+1zwAeAPYUq5ziO\n4/F4Cj1MREQumveXpme2xe2MMR4unmUEcD+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r2MMb8rjHmL92bCSANvFptbWGt3W2tvcNaeyfwJvAfgWeqrR1c9+POrRpjOsh+0f+4GG1RdmcZ\nAU+S/Utgr3v7/lJWpgRya4n8KfCIOwl0EPiWe9bAV4GfkQ3zz1lrCy8RuvR8jmzX9ovGmNxcwp8A\nX63C9vgW8Lgx5jmghmw7HKJ6Pxs5DtX7O/J14B+MMbk5g/vJ9hKuuC20lpGIiADlOWQkIiIloEAQ\nERFAgSAiIi4FgoiIAAoEERFxKRBERAQoz+sQRBaFMWYd8Ky19upL7s8A9wI7rbVfmuX4nwJfstY+\nN03ZduDLwBqyV1n/nOyFdgNFewMiRaYegsg0rLXfny0MXNNexGOM2Ux2gcYvW2uvBbYCR4CfuCt2\nipQl9RBEpmGM+U/AHdba+40xdwBfJbv44M+BLe4SCgAPGGO+AjQDf2KtfQr4DPCotfZZAGutA/yN\nMebXgY8C31jcdyNyedRDkGrXYYx5I/+//EJjjB/438BvW2tvBMa42DPwAIPW2p3Ap7i4ZPcusuvI\nXOp54OaFeBMixaAeglS7c9ba7fl3uHMIOVuBbmttblGwx8guQw3ZYPiO+/NBoLXAa9UxwzCTSDlQ\nD0Fkdmkm/554LinP7WHh5JXtI68nYIxpcX98N/DqAtRRpCgUCCKzewdoNsZc797+bSbvzTCdvwHu\nN8b8srsn8lPGmB8B9cC/LlxVRa6MAkGq3WxDOI61dhz4OPBPxphXgdVk9yWY8bncTUs+APwl2fXn\nm8nuXDVIdnN4kbKk5a9FZmGM8ZC9nuC/WmtHjTGfBlZaa/98Hs/VCmy21r5Y7HqKFIMCQaQAY8xf\nkN2haww4Dvy+tbbStmUUUSCIiEiW5hBERARQIIiIiEuBICIigAJBRERcCgQREQEUCCIi4vr/qZL8\n9lQQMb8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10beb0390>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.distplot(weed_jan2015_summarized.HighQ, bins=range(0,500,10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#Using `scipy` to use distribution"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from scipy import stats\n",
    "import scipy as sp\n",
    "import numpy as np\n",
    "import matplotlib as mpl\n",
    "from matplotlib import pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x10c5f9350>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAECCAYAAADq7fyyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHNJJREFUeJzt3X+U3HV97/Hn7CbZbXM3UXARAS+QcPJGEUIvWhBTSKRL\niTdpV4tHqBcuKY3WKhX0nlR+Xn+kYukRJeJFm1poocV75WAooQRye6lCkB9X0HCDfAAFKT8ka4Vk\nSTPL7s7cP2Ymmd2dnR/f35/vvB7n5JxksrPf93znO+/5fN+fX4VyuYyIiORHT9oBiIhItJTYRURy\nRoldRCRnlNhFRHJGiV1EJGeU2EVEcmZOmCeb2UHAD4HTnHNPRhOSiIiEEbjFbmZzgW8Ce6ILR0RE\nwgpTivlL4DrgpYhiERGRCARK7GZ2HjDinLu7+lAhsohERCSUQpAlBczse0C5+ud4wAG/55x7Odrw\nRESkU4ESez0zuwf4aLPO03K5XC4U1KgXEelA4KQZalRMuwqFAiMjo0kcKnKDgwPexg6KP22KP10+\nxz84OBD4uaETu3NuRdjfISIi0dEEJRGRnFFiFxHJGSV2EZGcUWIXEckZJXYRkZxRYhcRyRkldhGR\nnFFiFxHJGSV2EZGcUWIXEckZJXYRkZxRYhcRy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BzjKOVesflve\nSGXRsIXA7rqnjlYfy6IFTI11snqrmlnOuT3OudeqX6DfAS5j6nv8Gtk935jZeVTuOO6uPlRg6lpE\nmY4fGAROAM4E/hj4B/yKfxvQDzxB5a5pAxmP3zl3K5XyRE19vLX8sgDY1eDx1E2P3zn3CwAzOxn4\nOJUGcsfxR1Jjb7SmTDW4Y4GbgU875+6tLvc7UPcjC4BXo4ghBruZGmuPc66UVjDtMrO3UrmF+7pz\n7mYzu6ruvwfI7vkGWAOUzey3geOBv6WSLGuyHv8vgZ845yaAJ82sCBxa9/9Zj38dlZbhpWZ2GHAP\nlVZjTdbjh0ptvaaWX6Z/lgeAV5IMqhNm9iHgEuB9zrl/M7OO44+tBWpmb6fSajzbOXcXQPU24nUz\nW1S93Tsd+H6TX5OmbcD7AKodvtub/3j6qrW4u4F1zrkbqg8/amanVv++kuyeb5xzpzrnllfriz8C\nzgW2+BI/cB+Vvg3M7BDg14F/9ij++ey/S32FSsPPm+unqlG8DwG/ZWZ91UEdb6PSsZo5ZvZfqLTU\nlzvnnq0+3HH8sY2KodLxMg/YUF3e91Xn3Pup3KL+PdAL3OWcezjGGML4LjBkZtuq/16TZjBtuoTK\nLdoVZlartX+SynswD3gcuCWt4AIoA58GNvoQv3PuDjM7xcweotJo+hPgWTyJn0r/xvVmdi+VlvrF\nVEYn+RB/baTOjOulOipmA3AvlfflkgwuXFiulnqvobI0+q3VvPkvzrnPdRq/1ooREcmZTHcGiohI\n55TYRURyRoldRCRnlNhFRHJGiV1EJGeU2EVEckaJXUQkZ5TYRURy5v8DNki22f8o7WUAAAAASUVO\nRK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10c459d50>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Generate random numbers that are normally distributed\n",
    "random_normal = sp.randn(100)\n",
    "plt.scatter(range(100), random_normal)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mean: 0.0805473091391  variance: 1.02607046761\n"
     ]
    }
   ],
   "source": [
    "print \"mean:\", random_normal.mean(), \" variance:\", random_normal.var()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#Create a normal distribution with mean 2.5 and standard deviation 1.7\n",
    "\n",
    "n = stats.norm(loc=2.5, scale=1.7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4.024924590240284"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Generate random number from that distribution\n",
    "n.rvs()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.10157711386142985"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#for the above normal distribution, what is the pdf at 0.3?\n",
    "n.pdf(0.3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#Binomial distribution with `p` = 0.4 and number of trials as 15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([  6.04661760e-03,   4.03107840e-02,   1.20932352e-01,\n",
       "         2.14990848e-01,   2.50822656e-01,   2.00658125e-01,\n",
       "         1.11476736e-01,   4.24673280e-02,   1.06168320e-02,\n",
       "         1.57286400e-03,   1.04857600e-04,   0.00000000e+00,\n",
       "         0.00000000e+00,   0.00000000e+00,   0.00000000e+00])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stats.binom.pmf(range(15), 10, 0.4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Standard Error\n",
    "\n",
    "It is a measure of how far the estimate to be off, on average. More technically, it is the standard deviation of the sampling distribution of a statistic(mostly the mean). Please do not confuse it with *standard deviation*. Standard deviation is a measure of the variability of the observed quantity. Standard error, on the other hand, describes variability of the estimate. \n",
    "\n",
    "To illustrate this, let's do the following.\n",
    "\n",
    "Not everyone buying weed reports it on the site. Let's assume that the actual mean price for that month was 243.7. Compute standard deviation and standard error for the mean. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>State</th>\n",
       "      <th>HighQ</th>\n",
       "      <th>HighQN</th>\n",
       "      <th>MedQ</th>\n",
       "      <th>MedQN</th>\n",
       "      <th>LowQ</th>\n",
       "      <th>LowQN</th>\n",
       "      <th>date</th>\n",
       "      <th>month</th>\n",
       "      <th>year</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>California</td>\n",
       "      <td>243.96</td>\n",
       "      <td>16512</td>\n",
       "      <td>189.35</td>\n",
       "      <td>19151</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1096</td>\n",
       "      <td>2015-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>820</th>\n",
       "      <td>California</td>\n",
       "      <td>243.95</td>\n",
       "      <td>16517</td>\n",
       "      <td>189.34</td>\n",
       "      <td>19160</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1096</td>\n",
       "      <td>2015-01-02</td>\n",
       "      <td>1</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1534</th>\n",
       "      <td>California</td>\n",
       "      <td>243.93</td>\n",
       "      <td>16530</td>\n",
       "      <td>189.38</td>\n",
       "      <td>19179</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1096</td>\n",
       "      <td>2015-01-03</td>\n",
       "      <td>1</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2299</th>\n",
       "      <td>California</td>\n",
       "      <td>243.91</td>\n",
       "      <td>16542</td>\n",
       "      <td>189.38</td>\n",
       "      <td>19193</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1099</td>\n",
       "      <td>2015-01-04</td>\n",
       "      <td>1</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3064</th>\n",
       "      <td>California</td>\n",
       "      <td>243.91</td>\n",
       "      <td>16558</td>\n",
       "      <td>189.39</td>\n",
       "      <td>19222</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1100</td>\n",
       "      <td>2015-01-05</td>\n",
       "      <td>1</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           State   HighQ  HighQN    MedQ  MedQN  LowQ  LowQN       date  \\\n",
       "55    California  243.96   16512  189.35  19151   NaN   1096 2015-01-01   \n",
       "820   California  243.95   16517  189.34  19160   NaN   1096 2015-01-02   \n",
       "1534  California  243.93   16530  189.38  19179   NaN   1096 2015-01-03   \n",
       "2299  California  243.91   16542  189.38  19193   NaN   1099 2015-01-04   \n",
       "3064  California  243.91   16558  189.39  19222   NaN   1100 2015-01-05   \n",
       "\n",
       "      month  year  \n",
       "55        1  2015  \n",
       "820       1  2015  \n",
       "1534      1  2015  \n",
       "2299      1  2015  \n",
       "3064      1  2015  "
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Weed prices of Calinfornia for the month of Jan 2015\n",
    "weed_ca_jan2015 = weed_pd[(weed_pd.State==\"California\") & (weed_pd.month==1) & (weed_pd.year==2015)]\n",
    "weed_ca_jan2015.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Sample Mean: 243.602258065 \n",
      "Sample Standard Deviation: 0.211371863114\n"
     ]
    }
   ],
   "source": [
    "#Mean and standard deviation of the price of high quality weed in California\n",
    "print \"Sample Mean:\", weed_ca_jan2015.HighQ.mean(), \"\\n\", \"Sample Standard Deviation:\", weed_ca_jan2015.HighQ.std()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "243.96 243.27\n"
     ]
    }
   ],
   "source": [
    "print weed_ca_jan2015.HighQ.max(), weed_ca_jan2015.HighQ.min()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We'll follow the same procedures we did in the `resampling.ipynb`.  We will bootstrap samples from actual observed data 10,000 times and compute difference between sample mean and actual mean. Find root mean squared error to get standard error"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "def squared_error(bootstrap_sample, actual_mean):\n",
    "    return np.square(bootstrap_sample.mean() - actual_mean)\n",
    "\n",
    "def experiment_for_computing_standard_error(observed_prices, number_of_times, actual_mean):\n",
    "    bootstrap_mean = np.empty([number_of_times, 1], dtype=np.int32)\n",
    "    bootstrap_sample = np.random.choice(observed_prices, size=[observed_prices.size, number_of_times], replace=True)\n",
    "    bootstrap_squared_error = np.apply_along_axis(squared_error, 1, bootstrap_sample, actual_mean)\n",
    "    return np.sqrt(bootstrap_squared_error.mean())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.11893736492033181"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Standard error of the estimate for mean\n",
    "experiment_for_computing_standard_error(np.array(weed_ca_jan2015.HighQ), 10, 243.7)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
